<?php 

  require_once('nav.php'); 
?>

        <div class="col-sm-9 col-md-10">
 <?php 
$sql='select vid, videoname, videos.tid,typename, pic, intro, uploaddate, uploadadmin, hittimes,downtimes,address from videos left join videotype on videos.tid=videotype.tid';

 $result=fetch_array($sql);//取出一个记录放在数组里
 ?>
<center><h3>视频列表</h3></center>
 <table class=" table table-hover"> 
 <tr>
   <th>编号</th>
   <th>视频名称</th> 
   <th>类型编号</th>  
   <th>类型名称</th>
   <th width='80'>图片</th>
   <th>简介</th>
   <th>上传时间</th>
   <th>上传者</th> 
   <th>点击次数</th> 
   <th>下载次数</th> 
   <th>下载地址</th> 
   <th>操作</th>
 </tr>
   </div>
  </div>
</div>
  <?php 
 foreach ($result as $row) {
    echo '<tr>';
     echo '<td>'.$row['vid'].'</td>';
     echo '<td>'.$row['videoname'].'</td>';
      echo '<td>'.$row['tid'].'</td>';  
     echo '<td>'.$row['typename'].'</td>';
   echo '<td align="center"><img src=../images/'.$row['pic'].' width=60 height=80></td>';  
     echo '<td>'.$row['intro'].'</td>';
     echo '<td>'.$row['uploaddate'].'</td>';   
     echo '<td>'.$row['uploadadmin'].'</td>';    
   echo '<td>'.$row['hittimes'].'</td>';  
   echo '<td>'.$row['downtimes'].'</td>';  
   echo '<td>'.$row['address'].'</td>';       
     echo '<td><a href="videoedit-form.php?id='.$row['vid'].' ">修改</a> | 
     <a href="videodelete.php?id='.$row['vid'].'" onClick="return confirm(\'确定要删除吗？\');">删除</a></td>';
     echo '</tr>';  
 }
 echo '</table>';
$totalrows = count($result);
  echo "<table align='center'><tr><td>共有{$totalrows}个视频</td></tr></table>";   
 ?>
 </div>
     <?php
  require_once('footer.php');
    ?>